/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package functions;

import java.sql.Date;
import java.util.ArrayList;
import model.Item;
import stuff.FDate;

/**
 *
 * @author JArik
 */
public class ItemList<T extends Item>{
    private ArrayList<T> list;
    private Date date;
    private HealingSet belongsTo;

    public ItemList(Date nDate)
    {
        list = new ArrayList<T>();
        date = nDate;
    }
    public ItemList()
    {
        list = new ArrayList<T>();
    }
    public void add(T obj)
    {
        list.add(obj);
    }
    public void addAll(ArrayList t)
    {
        list.addAll(t);
    }
    
    public T get(int i)
    {
        return list.get(i);
    }
    public void setBelongsTo(HealingSet bl)
    {
        belongsTo = bl;
    }
    public HealingSet getBelongsTo()
    {
        return belongsTo;
    }
    public int size()
    {
        return list.size();
    }
    public Date getDate()
    {
        if(date == null) return null;
        return new FDate(date.getTime());
    }
    public Date getSQLDate()
    {
        if(date == null) return null;
        return new Date(date.getTime());
    }
        public void setDate(Date date) {
        this.date = date;
    }
    @Override
    public String toString()
    {
        if(date == null) return "Нет Даты";
        return new FDate(date.getTime()).toString();
    }
}
